package com.lesama.mextends.constructor;


/*
* 所有类在调用构造方法时都会默认调用super()父类的空参构造函数
* 所有类都直接或间接的继承了Object这个类
* */
public class ConstructorDemo {
    public static void main(String[] args) {
        Child child = new Child();
        Child child2 = new Child(10);
    }
}

class Father {
    public Father() {
        System.out.println("父类的空参构造方法");
    }
    public Father(int num) {
        System.out.println("父类的带参构造方法...");
    }
}

class Child extends Father{
    public Child() {
        System.out.println("子类的空参构造方法");
    }
    public Child(int num) {
        System.out.println("子类的带参构造方法...");
    }
}